package com.example.librarymanagementsystembackend.bookmanagement.entity;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.stereotype.Component;

/**
 * 图书信息
 */
@Schema(name = "BookInformation", description = "图书信息实体", requiredMode = Schema.RequiredMode.REQUIRED)
@Data
public class BookInformation {
    @Schema(description = "图书唯一标识符", example = "1001", required = true)
    private Integer id;

    @Schema(
            description = "国际标准书号(ISBN)",
            example = "978-7-04-052292-0",
            pattern = "^\\d{3}-\\d-\\d{2}-\\d{6}-\\d$",
            maxLength = 17
    )
    private String isbn;

    @Schema(description = "书名", example = "Spring Boot实战", required = true, minLength = 1)
    private String title;

    @Schema(description = "作者", example = "张三")
    private String author;

    @Schema(
            description = "封面图片URL",
            example = "https://example.com/covers/spring-boot.jpg",
            format = "uri"
    )
    private String coverUrl;

    @Schema(
            description = "库存数量",
            example = "50",
            minimum = "0",
            defaultValue = "0"
    )
    private Integer stock;

    @Schema(
            description = "所属分类ID",
            example = "3"
//            allowableValues = {"1", "2", "3", "4", "5"}
    )
    private Integer categoryId;
}